<template>
	<div class="app-container">
		<el-table v-loading="loading" :data="examinationinfoList">
			<el-table-column type="selection" width="55" align="center" />
			<el-table-column label="学院名称" align="center" prop="collegeName" />
			<el-table-column label="已完成人数" align="center" prop="collegeFinish" />
			<el-table-column label="及格人数" align="center" prop="qualifiedFinish" />
			<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
				<template slot-scope="scope">
					<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">查看详情</el-button>
				</template>
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
	import {
		listBranchanswer
	} from "@/api/system/branchanswer.js";
	import store from '@/store'
	export default {
		name: "Branchanswer",
		components: {},
		data() {
			return {
				// 遮罩层
				loading: true,
				// 选中数组
				ids: [],
				// 非单个禁用
				single: true,
				// 非多个禁用
				multiple: true,
				// 显示搜索条件
				showSearch: true,
				// 总条数
				total: 0,
				// 分院答题情况信息表格数据
				examinationinfoList: [],
				// 弹出层标题
				title: "",
				// 是否显示弹出层
				open: false,
				// 查询参数
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					examinationId: null,
					collegeName: null,
					collegeFinish: null,
					qualifiedFinish: null,
					userName: null,
					userUnity: null
				}
			};
		},
		created() {
			this.getList();
		},
		methods: {
			/** 查询考试信息列表 */
			getList() {
				this.loading = true;
				//路由传值的考试号
				let examinationid = this.$route.query.examinationId
				this.queryParams.examinationId = examinationid;
				this.queryParams.userUnity = store.getters.userroles.roleId;
				this.queryParams.userName = store.getters.userId;
				listBranchanswer(this.queryParams).then(response => {
					this.examinationinfoList = response.rows;
					this.total = response.total;
					this.loading = false;
				});
			},
			/** 查看详情按钮操作 */
			handleUpdate(row) {
				let examinationId = this.$route.query.examinationId;
				this.$router.push({
					path: '/branchdetail',
					query: {
						examinationId: examinationId,
						collegeValue:  row.collegeValue
					}
				});
			}
		}
	};
</script>
